Skip to content

Conversation

@strawhatduckk
Copy link

Add ability to inject Stripe API keys programmatically when using live mode, instead of requiring environment variables.

Before:

Live mode required STRIPE_TEST_SECRET_KEY and STRIPE_TEST_OAUTH_ACCESS_TOKEN to be set as environment variables.

After:

API keys can be provided via:

  1. Inline arguments to toggle_live
  2. A configuration block
  3. Environment variables (still supported as fallback)

Usage

# Option 1: Inline arguments
StripeMock.toggle_live(true, 
  api_key: 'sk_test_...', 
  oauth_access_token: '...'
)

# Option 2: Configuration block
StripeMock.configure do |config|
  config.api_key = 'sk_test_...'
  config.oauth_access_token = '...'
end
StripeMock.toggle_live(true)

# Option 3: Environment variables (existing behavior)
# Falls back to ENV['STRIPE_TEST_SECRET_KEY'] if no other value provided
StripeMock.toggle_live(true)

@strawhatduckk strawhatduckk self-assigned this Dec 8, 2025
@strawhatduckk strawhatduckk changed the title feat: Accept stripe keys as configuration or turning on live mode Accept stripe keys as configuration or turning on live mode Dec 8, 2025
@strawhatduckk strawhatduckk marked this pull request as draft December 22, 2025 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants